#include "globals.h"

#define BOARD_SIZE 50

extern "C" {

	// Shared structs between C# and C++
	//==================================

	struct EXPORT BoardInfo {
		short s1[128];
	};

	struct EXPORT ValidMovements {
		bool valid[BOARD_SIZE];
	};
	

	// Functions visible from C#
	//==========================

	//Sets the initial disposition of the board and returns it
	EXPORT BoardInfo NewGame() {
		BoardInfo a;
		a.s1[0] = 1;
		return a;
	}

	//Gets the current disposition of the board
	//We should not need this, if we update correctly the C# part, but is easy to code
	EXPORT BoardInfo GetCurrentBoard() {
		return BoardInfo();
	}

	//px, py: Pawn position
	//return: an array of boolean, each one corresponding to one tile
	//        if the boolean is true, it means the given pawn can move there
	EXPORT ValidMovements GetValidMovements(int px, int py) {
		return ValidMovements();
	}

	//px, py: Pawn position
	//return: an array of boolean, each one corresponding to one tile,
	//        if the boolean is true, it means the tile on that location can be moved
	EXPORT ValidMovements GetMovableTiles() {
		return ValidMovements();
	}

	//px, py: Pawn origin
	//dx, dy: Pawn destination
	//tx, ty: If the movement is outside the board, you also need to say which tile to move
	//return: if the movement is valid
	EXPORT bool Move(int px, int py, int dx, int dy, int tx, int ty) {
		return true;
	}

	//Calls the AI functions that will do a computer movement, and returns the updated board
	EXPORT BoardInfo ComputerMovement() {
		return BoardInfo();
	}


	// Testing
	//=========================

	EXPORT BoardInfo Test(BoardInfo board) {
//		board.pawns[0] += 5;
		return board;
	}
	EXPORT int GetSize() {
		return 42;
	}

}
